﻿(function (module) {

    var ctrl = function ($log, $parse, $scope) {
        $scope.sayHello = 'Hello :-)';

        $scope.items = [{
            firstName: 'Mauro',
            lastName: 'Servienti',
            dataType: 'people'
        }, {
            companyName: 'topics.it',
            dataType: 'companies'
        }];

        $scope.raw = '{ foo:0, dataType:\'this-is-invalid\' }';
        $scope.addRaw = function () {
            var obj = $scope.$eval($scope.raw);
            $log.debug(obj);
            $scope.items.push(obj);
            $scope.raw = '';
        };

    };
    ctrl.$inject = ['$log', '$parse', '$scope'];
    module.controller('homeController', ctrl);

}(angular.module('topics.controllers')));